'use strict';
define(['../main'],function(module){
    module.controller("depositBalanceCtrl",function($scope,$http,$rootScope){
        $rootScope.navActive='/web/deposit';
        $scope.balanceType=[
            {key:1,value:'真实备用金'},
            {key:2,value:'虚拟备用金'}
        ];
        $scope.currentBalanceType=$scope.balanceType[0];
        $scope.endTime=$rootScope.commonUtil.addDate(-1);     //结束时间
        $scope.searchKey='';            //关键字
        $scope.balanceData={            //备用金余额数据
            pageNum:1,
            pageSize:20,
            list:[]
        };
        $scope.searchBalance=function(page){
            var param={
                endTime:$scope.endTime,
                depositType:$scope.currentBalanceType.key,
                searchKey:$scope.searchKey,
                pageNum:page,
                pageSize:$scope.balanceData.pageSize
            };
            $http.get("api/deposit/balance",{params:param}).success(function(data){
                $scope.balanceData=data;
                console.log(data);
            });
        };
        $scope.exportBalance=function(){
            $("#exportForm").submit();
        };
    });
});
